package com.zxx.pattern.statePattern.state2;

/**
 * @author zxx on 2021/1/18
 */
public class TestState2 {

    public static void main(String[] args) {
        Room2 room2 = new Room2();

        room2.checkOutRoom();
        room2.checkInRoom();        //成功入住
        room2.unsubscribeRoom();
        room2.bookRoom();           //预定

        Room2[] rooms = new Room2[2];
        System.out.println("长度："+rooms.length);
        for (int i = 0; i < rooms.length; i++) {
            rooms[i] = new Room2();
        }

        //第一间房
        rooms[0].bookRoom();    //预定
        rooms[0].checkInRoom(); //入住
        rooms[0].bookRoom();
        System.out.println(rooms[0]);
        System.out.println("---------------------------");

        //第二间房
        rooms[1].checkInRoom();
        rooms[1].bookRoom();
        rooms[1].checkOutRoom();
        rooms[1].bookRoom();
        System.out.println(rooms[1]);


    }


}
